<!DOCTYPE html>
<html lang="zh_cn">
<head>
<meta charset="UTF-8">
<link href="/crm-core/css/bootstrap_css_4/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/crm-core/js/jquery/jquery-3.7.1-min.js"></script>
<script type="text/javascript" src="/crm-core/js/bootstrap_js_4/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function() {
	// 添加键盘按下时间
	$(window).keydown(function(event) {
	    if (event.keyCode === 13) {
		    $("#loginBtn").click();
	    }
	});

	// 登录事件
	$("#loginBtn").click(function() {
	    // 收集信息
	    var loginAcc = $.trim($("#loginAcc").val());
	    var loginPwd = $("#loginPwd").val();
	    var isRemembered = $("#isRemembered").prop("checked");
	    // 发送请求
	    $.ajax({
		url : '/crm-core/settings/qx/user/login.do',
		type : "post",
		dataType : "json",
		data : {
		    loginAcc : loginAcc,
		    loginPwd : loginPwd,
		    isRemembered : isRemembered
		},
		success : function(data) {
		    if (data.code === "1") {
			// 登录成功
			window.location.href = "/crm-core/workbench/index.do";
		    }
		    if (data.code === "0") {
			// 登录失败
			$("#msg").text(data.message);
		    }
		},
		beforeSend : function() {
		    // 表单验证
		    if (loginAcc === "") {
			alert("用户名不能为空");
			return false;
		    }
		    if (loginPwd === "") {
			alert("密码不能为空");
			return false;
		    }
		    // 表单验证成功，准备发送请求
		    $("#msg").text("正在验证登录信息...");
		    return true;
		}
	    })
	})
    })
</script>
<style type="text/css">
#msg {
	color: darkred;
}
</style>
</head>
<body>
	<div style="position: absolute; top: 0; left: 0; width: 60%;">
		<img src="/crm-core/image/IMG_7114.JPG" style="width: 100%; height: 90%; position: relative; top: 50px;" alt="">
	</div>
	<div id="top" style="height: 50px; background-color: rgb(0, 128, 128); width: 100%;">
		<div
			style="position: absolute; top: 5px; left: 0px; font-size: 30px; font-weight: 400; color: white; font-family: 'times new roman'">
			CRM &nbsp;<span style="font-size: 12px;">&copy;2030&nbsp;UMBRELLA</span>
		</div>
	</div>
	<div style="position: absolute; top: 120px; right: 100px; width: 450px; height: 400px; border: 1px solid #D5D5D5">
		<div style="position: absolute; top: 0px; right: 60px;">
			<div class="page-header">
				<h1>登录</h1>
			</div>
			<div class="form-group form-group-lg">
				<div style="width: 350px;">
					<input class="form-control" id="loginAcc" type="text" placeholder="用户名">
				</div>
				<div style="width: 350px; position: relative; top: 20px;">
					<input class="form-control" id="loginPwd" type="password" placeholder="密码">
				</div>
				<div class="checkbox" style="position: relative; top: 30px; left: 10px;">
					<label> <input id="isRemembered" type="checkbox"> 十天内免登录
					</label> &nbsp;&nbsp; <span id="msg"></span>
				</div>
				<button type="button" id="loginBtn" class="btn btn-primary btn-lg btn-block"
					style="width: 350px; position: relative; top: 45px;">登录</button>
			</div>
		</div>
	</div>
</body>
</html>